package com.lbssoft.datalink.sync;

import com.alibaba.fastjson.JSON;
import com.lbssoft.datalink.model.Result;
import com.lbssoft.datalink.entity.SyncGeofence;
import com.lbssoft.datalink.util.Constant;
import com.lbssoft.datalink.util.HttpClientUtil;

public class GeofenceService {
	String appsecret;

	 public GeofenceService(String appsecret){
		 this.appsecret = appsecret;
	}

	public Result add(SyncGeofence geofence) {
		return HttpClientUtil.sendHttpPostJson(Constant.SERVER_CONTEXT_URL+"/geofences",appsecret, JSON.toJSONString(geofence));
		//return httpUtils.post(Constant.SERVER_CONTEXT_URL+"/geofences", body,appsecret);
	}

	public Result delete(String uuid) {
		// TODO Auto-generated method stub
		return HttpClientUtil.sendHttpDelete(Constant.SERVER_CONTEXT_URL+"/geofences/"+uuid,appsecret);
		//return httpUtils.delete(Constant.SERVER_CONTEXT_URL+"/geofences/"+geofenceId,appsecret);
	}

	public Result update(SyncGeofence geofence) {
		// TODO Auto-generated method stub
		return HttpClientUtil.sendHttpPut(Constant.SERVER_CONTEXT_URL+"/geofences/"+geofence.getUuid(),appsecret,JSON.toJSONString(geofence));
		//return httpUtils.put(Constant.SERVER_CONTEXT_URL+"/geofences/"+id, body,appsecret);
	}


}
